package wzc.design_pattern.behaviour.observer;

/**
 * @Author 那和不是个啥
 * @Date 2025/7/20
 * @Description
 */

public class ObserverPatternDemo {
    public static void main(String[] args) {
        WeatherStation weatherStation = new WeatherStation();

        PhoneDisplay phoneDisplay = new PhoneDisplay();
        TVDisplay tvDisplay = new TVDisplay();

        weatherStation.registerObserver(phoneDisplay);
        weatherStation.registerObserver(tvDisplay);

        weatherStation.setWeather("晴天");

        weatherStation.removeObserver(phoneDisplay);

        weatherStation.setWeather("雨天");
    }
}
